<div class="cart_title"><div class="cart_title_content">GIỎ HÀNG</div></div>

<div class="cart_item_content"> 
	{$msg}
    {if $cart_items}
    <table width="100%" cellspacing="1" cellpadding="5"  bgcolor="#cccccc" border="0">
    	<tr>
            <td align="center" bgcolor="#F3F3F3"><strong>STT</strong></td>
            <td align="center" bgcolor="#F3F3F3"><strong>Ảnh</strong></td>
            <td width="37%" bgcolor="#F3F3F3"><strong>Sản phẩm</strong></td>
            <td width="13%" align="right" bgcolor="#F3F3F3"><strong>Đơn giá</strong></td>
            <td width="5%" align="center" bgcolor="#F3F3F3"><strong>Số lượng</strong></td>
          <td width="9%" align="center" bgcolor="#F3F3F3">
          	<input type="checkbox" onclick="cart_check_all()" title="Chọn tất cả" id="chkAll" name="chkAll"  style="height:26px;width:26px">
            </td>
            <td width="11%" bgcolor="#F3F3F3"><strong>Thành tiền</strong></td>
          <td width="10%" align="center" bgcolor="#F3F3F3"></td>
        </tr>
        {assign var="stt" value="0"}
        {foreach from=$cart_items item=item name=cart_item}
        {assign var="stt" value=$stt+1}
        <tr  bgcolor="#Ffffff">
          <td width="4%" align="center">
            {$stt}
          </td>
            <td width="10%" align="center">
                {if $item.img_url} 
                    <a href="{$item.url}"><img src="{$item.img_url}" width="120" height="120"/></a>
                {/if}
            </td>
            <td ><a href="{$item.url}" {$onmouseover} >{$item.name}</a></td>
            <td align="right" nowrap="nowrap" bgcolor="#Ffffff">
            	<font color="#CC0000"><strong>{$item.price} VNĐ</strong></font>
                <input name="price_item[{$item.id}]" type="hidden" id="price_item{$item.id}" value="{$item.price_num}"/>
            </td>
            <td align="center" bgcolor="#Ffffff">
                <input name="quantity[{$item.id}]" type="text" id="quantity_{$item.id}" value="{$item.quantity}" size="5" class="tAC p3 bold" onchange="cart_change_quantity({$item.id});" />
            </td>
            <td align="center" bgcolor="#Ffffff">
                <input type="checkbox" {if $item.checked}checked="checked"{/if} name="checked[{$item.id}]" onclick="cart_check({$item.id});" class="cart_item_cb" title="Chọn thanh toán" id="cart_item_{$item.id}" value="1" style="height:26px;width:26px" lang="{$item.id}"/>
            </td>
            <td nowrap="nowrap" bgcolor="#Ffffff"><font color="#CC0000"><b id="item_price_{$item.id}">{$item.row_total}</b></font></td>
            <td width="10%" align="center" nowrap="nowrap" bgcolor="#Ffffff">
                <a href="{$item.delete}" onclick="return confirm('Bạn có chắc chắn muốn xóa bỏ sản phẩm này trong giỏ hàng không?');" style="color:#F00" title="Loại sản phẩm khỏi giỏ hàng"><img src="style/img/cart/cart_del.png" alt="[ Xóa ]"/></a>
            </td>
        </tr> 
        {/foreach}
        <tr>
            <td colspan="4" align="right" bgcolor="#fff"><strong>Tổng số:</strong></td>
            <td colspan="2" align="center" bgcolor="#fff"><b><span id="quantity_total">{$quantity_total}</span> sản phẩm</b></td>
            <td colspan="2" bgcolor="#fff"><font color="#CC0000"><b id="price_total">{$price_total}</b></font> <font color="#CC0000"><b>VNĐ</b></font></td>
        </tr>
        <tr>
          <td colspan="6" align="right" bgcolor="#fff">
          <a {$print_link} class="fl"><img src="style/img/printer.png" width="40" height="40" border="0" /> In đơn hàng</a>
          
          <input type="submit" name="submit" value="Cập nhật Giỏ hàng" onclick="jQuery('#cart_act').val('');" class="btn_hover"/></td>
          <td colspan="2" align="right" bgcolor="#fff"><input type="hidden" id="cart_act" name="cart_act" value=""/>
          <input type="submit"  name="submit2" value="Thanh toán đơn hàng »" onclick="jQuery('#cart_act').val('finish');" class="btn_hover"/></td>
        </tr>
    </table>
    {literal}
		<script>
			var cart_price 			= 0;
			var cart_quantity 		= 0;
			var cart_quantity_ar	= [];
			
			jQuery(document).ready(function(){				
				var cart_check_all = true;
				
				jQuery(".cart_item_cb").each(function(){
					cart_quantity_ar[this.lang] = parseInt( jQuery('#quantity_' + this.lang).val() );
					
					if(jQuery(this).is(':checked'))
					{
						cart_price 		+= parseInt( cart_quantity_ar[this.lang] ) * parseInt(	jQuery('#price_item' + this.lang).val()	);
						
						cart_quantity 	+= parseInt( cart_quantity_ar[this.lang] );
					}
					else					
					{
						cart_check_all = false;
					}
				});
				
				jQuery("#chkAll").attr('checked', cart_check_all);
				
				jQuery("#CartForm").submit(function(){//return true;	
					return cart_check_items();	
				});
			});
		</script>
    {/literal}
    {else}
    	<div style="padding:20px;color:#f00;font-size:18px" align="center">
        	Hiện chưa có sản phẩm nào trong giỏ hàng!
        </div>
	{/if}
</div>
	